<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title></title>
	<link rel="stylesheet" type="text/css" href="../css/index.css"/>
	<script src="../jquery/jquery-3.5.1.js"></script>

</head>
<body>
<div class="bg1"></div>
<div class="gyl">
	用户信息管理

	<div class="gy2" >打造国内最具规模的、最专业的用户信息服务平台 </div>
</div>
<div class="bg">
	<div class="wel">用户登录</div>
	<div class="user">
		<div style="">用户名</div>
		<input  type="text" name="username" id="username"  placeholder="admin" />
	</div>

	<div class="phone">
		<div style="">电话</div>
		<input  type="text" name="phone" id="phone"  placeholder="157..." />
	</div>

	<div class="email">
		<div style="">邮箱</div>
		<input  type="text" name="email" id="email"  placeholder="160..." />
	</div>

	<div class="password" >
		<div >密&nbsp;&nbsp;&nbsp;码</div>
		<input class="" type="password" name="password" id="password"  placeholder="......" />
	</div>
	<div class="rem" >
		<input type="checkbox" name="" id="" value="" />
		<div id="reb">
			记住密码
		</div>
	</div>
	<div class="fg" >
		<div style="font-size: 11px;margin-top: 11px;">
			<a style="font-size: 11px;" href="#">忘记密码？</a>
		</div>
	</div>
	<input class="btn" type="button" id="registerButton" name="注册" value="注册" />
</div>

</body>
<script>
	$("#registerButton").click(function () {
		$.ajax({
			url:"/register",         // 请求路径
			type:"post",            // 请求的方式，不区分大小写
			contentType:"application/json;charset=utf-8",
			data: JSON.stringify({                // 传递参数的key-value严格区分大小写
				username: $("#username").val(),
				password: $("#password").val(),
				email: $("#email").val(),
				phone: $("#phone").val()
			}),
			success:function(response){
				alert(response.msg);
				if(response.code === 200) {
					window.location.href = "/user/login.html";
				}
				console.log("数据: " + response);
			},
			error:function(response){
				console.log("出错" + response);
			}
		});
	});
</script>

</html>
